Fix xm block-list through the Xen-API for managed domains.
authorEwan Mellor <ewan@xensource.com>
Tue, 20 Mar 2007 17:33:35 +0000 (17:33 +0000)
committerEwan Mellor <ewan@xensource.com>
Tue, 20 Mar 2007 17:33:35 +0000 (17:33 +0000)
Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
tools/python/xen/xm/main.py

index 5f8449d37646987c91d76fa4f3d355935c28490e..c5b640ccec9a4fc41779dd0af9736c3ea5b688fe 100644 (file)
@@ -37,6 +37,7 @@ import time
 import datetime
 from select import select
 import xml.dom.minidom
+from xen.util.blkif import blkdev_name_to_number
 
 import warnings
 warnings.filterwarnings('ignore', category=FutureWarning)
@@ -1724,7 +1725,12 @@ def xm_block_list(args):
         vbd_refs = server.xenapi.VM.get_VBDs(get_single_vm(dom))
         vbd_properties = \
             map(server.xenapi.VBD.get_runtime_properties, vbd_refs)
-        devs = map(lambda x: [x.get('virtual-device'), map2sxp(x)], vbd_properties)
+        vbd_devs = \
+            map(server.xenapi.VBD.get_device, vbd_refs)
+        vbd_devids = \
+            map(blkdev_name_to_number, vbd_devs)
+        devs = map(lambda (devid, prop): [devid, map2sxp(prop)],
+                   zip(vbd_devids, vbd_properties))
     else:
         devs = server.xend.domain.getDeviceSxprs(dom, 'vbd')